<template>
	<view class="mysuggest">
		<view style="height: 40rpx;background-color: #F54642;"></view>
		<view class="title">
			<uni-nav-bar left-icon="back" title="我的反馈" backgroundColor="#F54642" color="white" @clickLeft="back">
			</uni-nav-bar>
		</view>
		<view class="list" v-if="list && list.length > 0">
			<view class="item" v-for="(item, index) in list" :key="item.id" @click="link_to(item.id)">
				<view class="tit">{{item.type_text}}</view>
				<view class="cnt">{{item.content}}</view>
				<view class="_cnt">提交时间：{{item.create_date}}</view>
			</view>
		</view>
		<view class="nodata" v-else>
			<image class="empty_img" :src="IMGLink+'/my/empty.png'" mode="widthFix"></image>
			<view>没有你想要的内容</view>
		</view>
	</view>
</template>

<script>
	import {
		getSuggestList
	} from "@/api/my/my.js"
	export default {
		data() {
			return {
				IMGLink: this.IMGLink,
				type: null,
				list: null
			}
		},
		onLoad(options) {
			this.getData()
			this.type = options.type || 1
		},
		onPullDownRefresh() {
			this.getData()
			setTimeout(() => {
				uni.stopPullDownRefresh()
			}, 500)
		},
		methods: {
			back() {
				if (+this.type === 2) {
					uni.switchTab({
						url: "/pages/my/my"
					})
					return
				}
				uni.navigateBack({
					delta: 1
				})
			},
			getData() {
				getSuggestList().then(res => {
					this.list = res.data.feedbackts
				})
			},
			link_to(id) {
				uni.navigateTo({
					url: `/pagesA/my/suggestion/suggestdetail?id=${id}`
				})
			}
		}
	}
</script>

<style scoped lang="scss">
	.mysuggest {
		width: 100%;
		height: 100%;
	}

	.item {
		margin: 0 auto;
		width: calc(100% - 24px);
		display: flex;
		flex-direction: column;
		justify-content: space-around;
		box-sizing: border-box;
		padding: 30rpx 0 18rpx;
		min-height: 182rpx;
		border-bottom: 2rpx solid #F4F4F4;
	}

	.tit {
		font-size: 30rpx;
		color: #292929;
	}

	.cnt {
		font-size: 28rpx;
		color: #292929;
	}

	._cnt {
		font-size: 26rpx;
		color: #767676;
	}

	.nodata {
		text-align: center;
		color: #7D7D7D;
		font-size: 24rpx;
		margin-top: 50%;

		.empty_img {
			width: 468rpx;
		}
	}
</style>
